import json
import random
qname=''
n=0
while not n:
    print("请输入文件编号")
    a=input()
    name="./ans"+a+".json"
    try:
        with open(file = name, mode = 'r', encoding = 'utf8') as f:
            ftext = f.read()
            qname="./ques"+a+".json"
        n=1
    except:
        continue

data = json.loads(ftext)

ans=data['map']
que=[]
for i in range(9):
    n=[]
    for j in range(9):
        if random.randint(0,1)==0:
            n.append(int(ans[i][j]))
        else:
            n.append(0)
    que.append(n)
    
        
f=open(qname,'w')
f.write('{\n    "map":')
f.write(str(que))
f.write('\n}')
f.close()